


#include "err_code_mk.h"


static const char *err_code_msg[]={
	"NO_ERR", // = 0,  // 0, 1 都表示成功
	"OK_KT1", // = 1,
	
	"ERR_MK", // = 2, // 2开始为失败	 
	"NOT_LOGIN",
	"NO_DEVICE",
	"GROUP_NUM_OVERFLOW",
	"ATTR_BUF_SMALL",
	"NONE_GROUP_NAME",
	"DEV_OR_GROUP_ADDR_ERR",
	"DEVICE_TYPE_NOT_SUPPORT",
	"SCENCE_NAME_ERR",
	"SCENE_FULL", // = 11,
	"DEVICE_NAME_ERR",
	"BIND_NUM_OVER_FLOW",
	"PID_ERR",
	"FORMAT_ERR",
	"NOT_SUPPORT", // = 16,
	"WHITELIST_FULL",//,
	"AUTOREG_POOL_FULL",
	"PLC_UART_QUEUE_ERR",
	"PLC_FRAME_HEAD_ERR",
	"AUTO_ADD_ALL_WHITELIST", // = 21,
	"CCO_RSP_TIMEOUT",
	"STA_RSP_TIMEOUT",
	"WAIT_NEXT_PKG",
	"MUST_DEL_ALL_SCENE_FIRST",
	"MUST_DEL_SCENES_WITH_THIS_DEVICE_FIRST", // = 26,
	"DEVICE_SCENE_SYNC_FAIL",
	"SYNC_LEVEL_ERR",
	"METER_BREAKER_NOT_EXIST",
	"OPEN_WHITELIST_ERR",
	"READ_PID_ERR", // = 31,
	"CMD_NO_SUPPORT",
	"MSG_ID_NOT_MATCH",
	"TIMERING_TASK_NUM_OVERFOLW", //,
	"TIMERING_TASK_ID_ERR", //,
	"FW_SIZE_TOO_LARGE", // = 36,
	"CHKSUM_ERR",
	"TRANSMIT_FW_TO_NODE_ERR",
	"RSP_BUF_TOO_SMALL",
	"NODE_OFFLINE", // = 40,
	"DOWNLOAD_FAIL",
	"PLC_BUSY",
	"RS485_BUSY",
	"OTA_FW_NOT_MATCH_DEVICE_TYPE",
	
    
	"SOME_PARAM_SET_ERR",  // 45
 	"DEVICE_TIMING_TASK_NUM_OVERFOLW",
	"READ_BK_STATUS_ERR",
	"CTRL_BK_FAIL",
	"NO_USB_DRV_FOR_GSM",  //  没有gsm usb 串口驱动
	
	"REG_ADDR_RANGE_OUT",  //  50 寄存器地址超范围
	"CLEAR_CCO_OTA_BUF_ERR",   //  清除cco ota 下装错误
	"TX_GW2CCO_BUF_ERR",      // 传输到cco 的ota 文件错误
	"TX_GW2CCO_BUF_ERR2",		// 传输到cco 的ota 文件错误
	"SCENE_EXEC_BUSY",      // 场景忙，还有正在执行的场景
	
	"SCENE_NOT_FOUND",   // 55
	"FILE_TRANS_BUSY",
	"FILE_SIZE_TOO_BIG",
	"FILE_NOT_FOUND",
	"SCENE_SYNC_BUSY",   
	
	"DPID_NOT_MATCH",   // 60
	"DATA_TYPE_NOT_MACTH",
	"ATTR_NOT_EQUAL",
	
	"UNKNOWN_ERR",
	"UNKNOWN_ERR",
};

const char *get_err_msg(unsigned int err_code)
{
	//printf("errcode=%d, size=%d\n", err_code, sizeof(err_code_msg)/sizeof(err_code_msg[0]));
	if(err_code >= sizeof(err_code_msg)/sizeof(err_code_msg[0])) {
		err_code = sizeof(err_code_msg)/sizeof(err_code_msg[0])-1;
	}
	return err_code_msg[err_code];
}
